<?php

namespace App\Http\Models\RoleUser;

use Illuminate\Database\Eloquent\Model;

class RoleUser extends Model
{
    protected $table = "role_user";

    /**
     * 新增展示的字段
     * @var array
     */
    protected $fillable = [
        'userid',
        'roleid',
        'created_at',
        'updated_at'
    ];

    /**
     * 查询显示该字段
     * @var array
     */
    protected $hidden = [
        'id',
        'userid',
        'roleid',
        'created_at',
        'updated_at'
    ];
    public function getRole()
    {
        return $this->belongsToMany('App\Http\Models\Role\Role', 'role_user', 'userid', 'roleid');
    }
}
